#include "database.h"
#include <sstream>

Database::~Database()
{
	map_itr_t	itr;
	for (itr = mymap.begin(); itr != mymap.end(); ++itr)
		delete itr->second;	
}

void
Database::insert(unsigned int id, NewsGroup* ng)
{
	mymap.insert(pair<unsigned int, NewsGroup*>(id, ng));
}

map_itr_t
Database::begin()
{
	return mymap.begin();		
}

map_itr_t
Database::end()
{
	return mymap.end();
}

void 
Database::erase(map_itr_t itr)
{
	mymap.erase(itr);	
}

map_itr_t
Database::find(unsigned int& id)
{
	return mymap.find(id);	
}

NewsGroup*
Database::operator[] (const unsigned int& key)
{
	return mymap[key];
}

size_t
Database::size()
{
	return mymap.size();
}

void
Database::update() {}
